package demo1;

public class Test {
    public static void drawMap(Shape shape){
        shape.draw();
    }

    public static void main(String[] args) {
        Shape cycle = new Cycle();
        Shape rect = new Rect();
        Shape triangle = new Triangle();
        Shape flower = new Flower();

        Shape [] shapes = {rect,rect,flower,cycle,triangle,triangle};
        for(Shape shape : shapes){
            shape.draw();
        }
    }

    public static void main2(String[] args) {
        Shape cycle = new Cycle();
        Shape rect = new Rect();
        Shape triangle = new Triangle();

        String[] strings = {"Rect","Rect","Cycle","Triangle","Triangle"};

        for (String x : strings) {
            if(x.equals("Rect")){
                rect.draw();
            } else if (x.equals("Cycle")) {
                cycle.draw();
            }else if(x.equals("Triangle")){
                triangle.draw();
            }
        }

    }

    public static void main1(String[] args) {
        Shape shape1 = new Cycle();
        Shape shape2 = new Rect();
        Shape shape3 = new Triangle();

        drawMap(shape1);
        drawMap(shape2);
        drawMap(shape3);
    }
}
